using MOKA.TPM.Utility.Const;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Entity;

/// <summary>
/// 点检记录详情
/// </summary>
[Tenant(TPMConst.TPMConfigId)]
[SugarTable("CheckupDetail", "点检记录详情")]
public class CheckupDetail
{
    /// <summary>
    /// 序号
    /// </summary>
    [SugarColumn(ColumnName = "Id", ColumnDescription = "序号", IsPrimaryKey = true)]
    public Guid Id { get; set; }

    /// <summary>
    /// 点检号
    /// </summary>
    [SugarColumn(ColumnName = "CheckupId", ColumnDescription = "点检号")]
    public Guid CheckupId { get; set; }

    /// <summary>
    /// 点检项
    /// </summary>
    [SugarColumn(ColumnName = "CheckupItemId", ColumnDescription = "点检项")]
    public Guid CheckupItemId { get; set; }

    /// <summary>
    /// 点检人
    /// </summary>
    [SugarColumn(ColumnName = "ItemFinishMan", ColumnDescription = "点检人", Length = 20)]
    [Required, MaxLength(20)]
    public string ItemFinishMan { get; set; } = string.Empty;

    /// <summary>
    /// 点检日期
    /// </summary>
    [SugarColumn(ColumnName = "ItemFinishTime", ColumnDescription = "点检日期")]
    public DateTime ItemFinishTime { get; set; }

    /// <summary>
    /// 参数值
    /// </summary>
    [SugarColumn(ColumnName = "IteParamValue", ColumnDescription = "参数值")]
    public decimal? IteParamValue { get; set; }

    /// <summary>
    /// 点检结果
    /// </summary>
    [SugarColumn(ColumnName = "ItemCheckupResult", ColumnDescription = "点检结果")]
    public Guid ItemCheckupResult { get; set; }

    /// <summary>
    /// 异常描述
    /// </summary>
    [SugarColumn(ColumnName = "ExceptionDesc", ColumnDescription = "异常描述", Length = 200)]
    [MaxLength(200)]
    public string? ExceptionDesc { get; set; }

    /// <summary>
    /// 异常原因
    /// </summary>
    [SugarColumn(ColumnName = "Reason", ColumnDescription = "异常原因", Length = 200)]
    [MaxLength(200)]
    public string? Reason { get; set; }

    /// <summary>
    /// 解决方法
    /// </summary>
    [SugarColumn(ColumnName = "Solution", ColumnDescription = "解决方法", Length = 200)]
    [MaxLength(200)]
    public string? Solution { get; set; }

    /// <summary>
    /// 更换配件号
    /// </summary>
    [SugarColumn(ColumnName = "PartId", ColumnDescription = "更换配件号")]
    public Guid? PartId { get; set; }

    /// <summary>
    /// 更换配件数量
    /// </summary>
    [SugarColumn(ColumnName = "PartCount", ColumnDescription = "更换配件数量")]
    public int? PartCount { get; set; }

    /// <summary>
    /// 处理结果
    /// </summary>
    [SugarColumn(ColumnName = "SolveResult", ColumnDescription = "处理结果")]
    public Guid? SolveResult { get; set; }

    /// <summary>
    /// 处理人
    /// </summary>
    [SugarColumn(ColumnName = "SolveMan", ColumnDescription = "处理人", Length = 20)]
    [MaxLength(20)]
    public string? SolveMan { get; set; }

    /// <summary>
    /// 处理时间
    /// </summary>
    [SugarColumn(ColumnName = "SolveTime", ColumnDescription = "处理时间")]
    public DateTime? SolveTime { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 200)]
    [MaxLength(200)]
    public string? Remark { get; set; }

    /// <summary>
    /// CheckupId (点检号) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(CheckupId), nameof(Checkup.Id))]//多对一
    public Checkup checkup_CheckupId { get; set; }

    /// <summary>
    /// CheckupItemId (点检项) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(CheckupItemId), nameof(CheckupItemTPMCategory.Id))]//多对一
    public CheckupItemTPMCategory checkupItemTPMCategory_CheckupItemId { get; set; }

    /// <summary>
    /// ItemFinishMan (点检人) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(ItemFinishMan), nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_ItemFinishMan { get; set; }

    /// <summary>
    /// ItemCheckupResult (点检结果) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(ItemCheckupResult), nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_ItemCheckupResult { get; set; }

    /// <summary>
    /// PartId (更换配件号) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(PartId), nameof(Parts.Id))]//多对一
    public Parts parts_PartId { get; set; }

    /// <summary>
    /// SolveResult (处理结果) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(SolveResult), nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_SolveResult { get; set; }

    /// <summary>
    /// SolveMan (处理人) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(SolveMan), nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_SolveMan { get; set; }
}